/*
 *  ETRender.cpp
 *  EidoTron
 *
 *  Created by Luca Di Franco on 07/03/11.
 *  Copyright 2011 Luca Di Franco. All rights reserved.
 *
 */

#include "EidoTronApp.h"

#include "../Scene_organization/SceneNode.h"


void EidoTronApp::render()
{
	glEnable(GL_DEPTH_TEST);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	float light0Pos[4] = {-1.0f, 0.0f, 0.0f, 0.0f };
	float light0Amb[4] = { 0.1f, 0.1f, 0.1f, 1.0f };
	float light0Dif[4] = { 0.9f, 0.9f, 0.9f, 1.0f };
	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_POSITION, light0Pos);
	glLightfv(GL_LIGHT0, GL_AMBIENT, light0Amb);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, light0Dif);
	float light1Pos[4] = { 0.0f, 1.0f, 1.0f, 0.0f };
	float light1Amb[4] = { 0.1f, 0.1f, 0.1f, 1.0f };
	float light1Dif[4] = { 0.5f, 0.5f, 0.5f, 1.0f };
	glEnable(GL_LIGHT1);
	glLightfv(GL_LIGHT1, GL_POSITION, light1Pos);
	glLightfv(GL_LIGHT1, GL_AMBIENT, light1Amb);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, light1Dif);
	
	SceneNode::renderTree();
		
	SDL_GL_SwapBuffers();
}